﻿#region Imports
using System;
using System.Windows.Forms;
using CommonUtilities.Enums;
using CommonUtilities.Messages;
using CommonUtilities.Util;
using DirectoryAnalyzer.Main;
using DirectoryAnalyzer.ResourceFiles;
#endregion

namespace DirectoryAnalyzer.Views
{
    public partial class frmStartUp : Form
    {
        #region Constructors
        public frmStartUp()
        {
            InitializeComponent();

            Program.IsMute = (Form.ModifierKeys == Keys.Shift);
            Notifications.PlaySound(eNotificationSound.Start, Program.IsMute);
        }
        #endregion

        #region Events
        private void btnDone_Click(object sender, EventArgs e)
        {
            Form frmFirstForm = new Form();
            Program.IsMute = chkMute.Checked;

            if (radSpaceAnalyzer.Checked) frmFirstForm = new frmSpaceAnalyzer();
            else if (radDuplicateFinder.Checked) frmFirstForm = new frmDuplicateFinder();

            this.Hide();
            frmFirstForm.ShowDialog(this);
            frmFirstForm = null;
            this.Show();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            if (MessageBoxUtil.Show(Program.IsDebug, ResourceDirectoryAnalyzer.Msg_ExitMainApp, ResourceDirectoryAnalyzer.App_Confirmation,
                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                this.Hide();
                Notifications.PlaySound(eNotificationSound.Exit, Program.IsMute);
                Application.Exit();
            }
        }

        private void frmStartUp_Load(object sender, EventArgs e)
        {
            chkMute.Checked = Program.IsMute;
        }
        #endregion
    }
}
